function setTime(time) {
	if (time < 10)
		return '0' + time;
	return time;
}

function getTime(datetime) {
	var year = datetime.getFullYear();
	var month = setTime(datetime.getMonth() + 1);
	var date = setTime(datetime.getDate());
	var hour = setTime(datetime.getHours());
	var minute = setTime(datetime.getMinutes());
	var second = setTime(datetime.getSeconds());
	return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":"
			+ second;
}

$(function() {
	setInterval(function() {
		$("#currentTime").text(getTime(new Date()));
	}, 1000);
});

$('#schoolBusTree').tree({
	url : 'resources/data/tree.json',
	onClick : function(node) {
		if ($('#homeContent').tabs('exists', node.text)) {
			$('#homeContent').tabs('select', node.text);
		} else {
			$('#homeContent').tabs('add', {
				title : node.text,
				href : node.attributes.url,
				closable : true
			});
		}
	}
});

$('#homeContent').tabs({
	fit : true
});
$('#homeContent').tabs('add', {
	title : '首页',
	href : '/schoolBus/dynamicCarNumberMg',
	closable : false
});